#include <WProgram.h>
#include "ROB_Led.h"


void CLed::Begin(uint8_t pinLed){
  _pinLed = pinLed;
  pinMode(_pinLed, OUTPUT);
  digitalWrite(_pinLed, HIGH);
  _ledOnCycles = 0;
}


void CLed::flash(uint8_t cycles) {
  _ledOnCycles = cycles;
  digitalWrite(_pinLed, HIGH);
}


void CLed::on(void) {
  digitalWrite(_pinLed, HIGH);
}


void CLed::off(void) {
  digitalWrite(_pinLed, LOW);
}



void CLed::update(void) {
  if(!_ledOnCycles)
    return;
  if(! (--_ledOnCycles))
    digitalWrite(_pinLed, LOW);
}


CLed Led;

